import Vue from 'vue'
import App from './App.vue'
import axios from "axios"
import iView from 'iview';
import 'iview/dist/styles/iview.css';
import VueRouter from 'vue-router'; 
import Login from "./pages/Login.vue";
import Admin from './pages/Admin'
import GoodsList from "./pages/GoodsList";
import store from "./store";
import OrderDetail from "./pages/OrderDetail";
Vue.use(VueRouter);
Vue.use(iView);
const routes = [

  {
    path: "/",
    redirect: "/admin"
  },
  {
    path: "/login",
    component: Login,
    meta: "登录"
  },
  {
    path: '/admin',
    component: Admin,
    redirect: "/admin/goods-list",
    meta: "后台管理",
    children: [
      { path: 'goods-list', component: GoodsList, meta: "商品列表" },
      {
      path: "order-detail/:id",
      component: OrderDetail,
      meta: "订单详情"
      }
    ]
  },







];

// 创建路由对象
const router = new VueRouter({
  routes
});

Vue.prototype.$axios = axios;

Vue.config.productionTip = false

// 设置axios的基础url，也就是每次发送请求的时候，会加上这一行的代码
axios.defaults.baseURL = "http://localhost:8899";
new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app')